﻿using System.Windows;
using System.Windows.Media;

namespace SilverlightUtils
{
	public static class Extensions
	{
		public static void SetClip(this FrameworkElement element)
		{
			element.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
			element.Clip = new RectangleGeometry
			{
				Rect = new Rect
				(
					0, 0,
					element.ActualWidth,
					element.ActualHeight
				)
			};
		}

		public static Point Subtract(this Point a, Point b)
		{
			Point ret = new Point();
			ret.X = a.X - b.X;
			ret.Y = a.Y - b.Y;
			return ret;
		}
	}
}
